#!bin/bash


if [ -n "$1" ] ; then
  data_date=$1
fi


ODS_USER_ACTION_LOG_SQL="
LOAD DATA INPATH '/warehouse/ads_basic/wyysj/user_action_log/2025-07-25'
    OVERWRITE INTO TABLE wyy_music_warehouse.ods_user_action_log PARTITION (dt='${data_date}')
;
"


ODS_USER_INFO_SQL="
LOAD DATA INPATH '/warehouse/ads_basic/wyysj/user_info/2025-07-25'
    OVERWRITE INTO TABLE wyy_music_warehouse.ods_user_info PARTITION (dt='${data_date}')
;
"

ODS_MUSIC_INFO_SQL="
LOAD DATA INPATH '/warehouse/ads_basic/wyysj/music_info/2025-07-25'
    OVERWRITE INTO TABLE wyy_music_warehouse.ods_music_info PARTITION (dt='${data_date}')
;
"

ODS_ARTIST_INFO_SQL="
LOAD DATA INPATH '/warehouse/ads_basic/wyysj/artist_info/2025-07-25'
    OVERWRITE INTO TABLE wyy_music_warehouse.ods_artist_info PARTITION (dt='${data_date}')
;
"

ODS_ALBUM_INFO_SQL="
LOAD DATA INPATH '/warehouse/ads_basic/wyysj/album_info/2025-07-25'
    OVERWRITE INTO TABLE wyy_music_warehouse.ods_album_info PARTITION (dt='${data_date}')
;
"

ODS_DEVICE_INFO_SQL="
LOAD DATA INPATH '/warehouse/ads_basic/wyysj/device_info/2025-07-25'
    OVERWRITE INTO TABLE wyy_music_warehouse.ods_device_info PARTITION (dt='${data_date}')
;
"


/opt/module/spark/bin/beeline -u jdbc:hive2://node101:10001 -n bwie -p 123456 -e "${ODS_USER_ACTION_LOG_SQL}${ODS_USER_INFO_SQL}${ODS_MUSIC_INFO_SQL}${ODS_ARTIST_INFO_SQL}${ODS_ALBUM_INFO_SQL}${ODS_DEVICE_INFO_SQL}"

